﻿using BigEgg.Framework.Foundation;
using FMStudio.Domain.Properties;
using FMStudio.Domain.Test.MockClasses;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace FMStudio.Domain.Test
{
    [TestClass]
    public class ItemPriceTest
    {
        [TestMethod]
        public void ItemPriceMarketValidationTest()
        {
            MockItemPrice itemPrice = new MockItemPrice();

            Assert.IsNull(itemPrice.Market);
            Assert.AreEqual(Resources.MarketMandatory, itemPrice.Validate("Market"));

            MockMarket market = new MockMarket();
            itemPrice.Market = market;
            Assert.AreEqual("", itemPrice.Validate("Market"));
        }

        [TestMethod]
        public void ItemPriceItemValidationTest()
        {
            MockItemPrice itemPrice = new MockItemPrice();

            Assert.IsNull(itemPrice.Item);
            Assert.AreEqual(Resources.ItemMandatory, itemPrice.Validate("Item"));

            MockItem item = new MockItem();
            itemPrice.Item = item;
            Assert.AreEqual("", itemPrice.Validate("Item"));
        }

        [TestMethod]
        public void ItemPricePriceValidationTest()
        {
            MockItemPrice currencyExchange = new MockItemPrice();

            Assert.AreEqual(default(double), currencyExchange.Price);

            currencyExchange.Price = 0.1;
            Assert.AreEqual("", currencyExchange.Validate("Price"));
            currencyExchange.Price = 0.0;
            Assert.AreEqual(Resources.PriceGreater, currencyExchange.Validate("Price"));
            currencyExchange.Price = -0.1;
            Assert.AreEqual(Resources.PriceGreater, currencyExchange.Validate("Price"));
        }
    }
}
